<?php

/**
 * 文件
 *
 * Created by PhpStorm.
 * User: evan
 * Date: 16/8/23
 * Time: 下午9:44
 */
class File extends MY_Api_Controller
{
    /**
     * 上传文件
     */
    public function upload()
    {
        set_time_limit(600);
        $key = trim($this->input->get_post('key'));
        $by_module = (int)$this->input->get_post('by_module');


        $this->load->service('common/service_common_file');
        $data = $this->service_common_file->upload($key, $by_module);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 获取文件
     */
    public function get()
    {
        $key  = trim($this->input->get_post('key'));
        $type = trim($this->input->get_post('type'));


        $this->load->service('common/service_common_file');
        $data = $this->service_common_file->get($key, $type);


        $this->json_output($data['data'], $data['status']);
    }
}